package com.ymatou.iapi.godmch.testcase;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.common.collect.Lists;
import com.ymatou.iapi.godmch.parameter.setAgentConditionMarkupConfigBean;
import com.ymatou.iapi.godmch.service.setAgentConditionMarkupConfigCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.godmch.markup_config_agent_price;
import com.ymttest.database.model.godmch.markup_config_agent_priceExample;
import com.ymttest.database.model.godmch.markup_config_condition;
import com.ymttest.database.model.godmch.markup_config_conditionExample;
import com.ymttest.database.sqlwapper.godmch.markup_config_agent_priceWapper;
import com.ymttest.database.sqlwapper.godmch.markup_config_conditionWapper;
import com.ymttest.utils.TestDataManager;
/**
*设置代理价按条件加价规则
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_setAgentConditionMarkupConfig{
	private static setAgentConditionMarkupConfigBean bean;
	private static setAgentConditionMarkupConfigCall call;
	markup_config_agent_priceWapper priceWapper=new markup_config_agent_priceWapper();
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("设置代理价按条件加价规则");
	}

	@Before
	public void caseUp() {
		bean=new setAgentConditionMarkupConfigBean();
		call=new setAgentConditionMarkupConfigCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	private void check_verify(Integer Condition_type,String lstStr) throws InterruptedException
	{
		Logger.verifyEquals("200", call.getStatusCode1(), "验证status");
		markup_config_agent_priceWapper priceWapper=new markup_config_agent_priceWapper();
		markup_config_agent_priceExample priceExample=new markup_config_agent_priceExample();
		priceExample.createCriteria().andMch_idEqualTo(bean.getMchId());
		priceExample.setOrderByClause(" create_time desc ");
		markup_config_agent_price agentPrice=priceWapper.selectByExample(priceExample).get(0);
		Logger.verifyEquals(false, agentPrice.getGlobal_config(), "验证markup_config_agent_price中的global_config");
		Logger.verifyEquals(bean.getDecimalType(), agentPrice.getDecimal_type(), "验证markup_config_agent_price中的Decimal_type");
		Logger.verifyEquals(bean.getRefreshProduct(), agentPrice.getRefresh_product(), "验证markup_config_agent_price中的Refresh_product");
		Logger.verifyEquals(0, agentPrice.getConfig_status(), "验证markup_config_agent_price中的Config_status");
		
		Logger.verifyEquals(Condition_type, agentPrice.getCondition_type(), "验证markup_config_agent_price中的Condition_type");
		Logger.verifyEquals(lstStr, agentPrice.getCondition_list(), "验证markup_config_agent_price中的Condition_list");
	}
	
	
	private void updateTimeConfig() throws InterruptedException
	{
		   //修改update_time 因为相同的agentid+suppelierId 1分钟内无法修改
		markup_config_agent_priceExample priceExample=new markup_config_agent_priceExample();
		priceExample.createCriteria().andMch_idEqualTo(bean.getMchId());
		markup_config_agent_price agentPrice=priceWapper.selectByExample(priceExample).get(0);
		agentPrice.setUpdate_time(Date.from((LocalDateTime.now().plusDays(-1).atZone(ZoneId.systemDefault()).toInstant())));
		priceWapper.updateByPrimaryKey(agentPrice);
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_001() {
		Logger.start(true,"设置代理价按条件加价规则-商户代理类型不存在-新增");
		try {

			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			//品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			
			call.setData(bean);
			call.callService();			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_002() {
		Logger.start(true,"设置代理价按条件加价规则-商户代理类型存在的-返回失败");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			//品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			
			call.setData(bean);
			call.callService();		
			call.callService();
			
			Logger.verifyEquals("500", call.getStatusCode1(), "验证status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_003() {
		Logger.start(true,"设置代理价按条件加价规则-商户与代理类型关系不存在-返回失败");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			bean.setMchId(11111);
			//品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			
			call.setData(bean);
			call.callService();		

			Logger.verifyEquals("500", call.getStatusCode1(), "验证status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_004() {
		Logger.start(true,"设置代理价按条件加价规则-品牌没重复-返回成功");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			//品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			
			call.setData(bean);
			call.callService();		
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_005() {
		Logger.start(true,"设置代理价按条件加价规则-品牌重复-返回失败");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			//品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			
			call.setData(bean);
			call.callService();	
			call.callService();	
			Logger.verifyEquals("500", call.getStatusCode1(), "验证status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_007() {
		Logger.start(true,"设置代理价按条件加价规则-分类没重复-返回成功");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			bean.setBrandList(null);
			//分类
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			
			call.setData(bean);
			call.callService();		
			
			String str="{\"category\":["+bean.getCategoryList().get(0)+"]}";
			check_verify(6,str);	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_008() {
		Logger.start(true,"设置代理价按条件加价规则-分类重复-返回失败");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			//品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			
			call.setData(bean);
			call.callService();		
			call.callService();	
			
			Logger.verifyEquals("500", call.getStatusCode1(), "验证status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_009() {
		Logger.start(true,"设置代理价按条件加价规则-仓库重复-返回失败");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			
			call.setData(bean);
			call.callService();		
			call.callService();		
			Logger.verifyEquals("500", call.getStatusCode1(), "验证status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_009_1() {
		Logger.start(true,"设置代理价按条件加价规则-仓库没重复-返回失败");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setBrandList(null);
			
			call.setData(bean);
			call.callService();		

			String str="{\"depot\":["+bean.getDepotList().get(0)+"]}";
			check_verify(7,str);	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_010() {
		Logger.start(true,"设置代理价按条件加价规则-仓库+分类都不存在-返回成功");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setBrandList(null);
		    //品牌
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			
			call.setData(bean);
			call.callService();		

			String str="{\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(4,str);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_011() {
		Logger.start(true,"设置代理价按条件加价规则-仓库+分类,仓库存在,分类不存在-返回成功");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setBrandList(null);
		    //品牌
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();		
			
		    //修改时间
		    updateTimeConfig();
			
		   //第二次执行 仓库存在,分类不存在
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    call.setData(bean);
		    call.callService();	

		    String str="{\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
		    check_verify(4,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_012() {
		Logger.start(true,"设置代理价按条件加价规则-仓库+分类都存在-返回失败");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setBrandList(null);
		    //品牌
            bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    call.setData(bean);
		    call.callService();	
		    //修改时间
		    updateTimeConfig();
		    call.callService();
		    Logger.verifyEquals("500", call.getStatusCode1(), "验证status");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_013() {
		Logger.start(true,"设置代理价按条件加价规则-仓库+品牌都不存在-返回成功");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setBrandList(null);
		    //品牌
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    call.setData(bean);
		    call.callService();
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(3,str);	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_014() {
		Logger.start(true,"设置代理价按条件加价规则-仓库+品牌都存在-返回成功");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setBrandList(null);
		    //品牌
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    call.setData(bean);
		    call.callService();
		    call.callService();		
			
		    Logger.verifyEquals("500", call.getStatusCode1(), "验证status");		
		    
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_015() {
		Logger.start(true,"设置代理价按条件加价规则-分类+品牌都不存在-返回成功");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setBrandList(null);
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"]}"; 
			check_verify(2,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_016() {
		Logger.start(true,"设置代理价按条件加价规则-分类+品牌,分类存在,品牌不存在-返回成功");
		try {
            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setBrandList(null);
		    //品牌
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			//修改时间
			updateTimeConfig();
			//第二次执行 分类存在,品牌不存在
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"]}"; 
			check_verify(2,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_017() {
		Logger.start(true,"设置代理价按条件加价规则-分类+品牌,分类不存在,品牌存在-返回成功");
		try {
			    bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
	            bean.setBrandList(null);
			    //品牌
			    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
				//修改时间
				updateTimeConfig();
				//第二次执行 分类不存在,品牌存在
			    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
				String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"]}"; 
				check_verify(2,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_018() {
		Logger.start(true,"设置代理价按条件加价规则-分类+品牌都存在-返回成功");
		try {
				
            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setBrandList(null);
		    //品牌
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();		
			call.callService();	
		
			Logger.verifyEquals("500", call.getStatusCode1(), "验证status");	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_019() {
		Logger.start(true,"设置代理价按条件加价规则-品牌+分类+仓库都不存在-返回成功");
		try {
            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();			
			
				String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
				check_verify(1,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_020() {
		Logger.start(true,"设置代理价按条件加价规则-品牌+分类+仓库,品牌分类不存在,仓库存在-返回成功");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			//修改时间
			updateTimeConfig();
			//第二次执行
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		   // bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
		
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_021() {
		Logger.start(true,"设置代理价按条件加价规则-品牌+分类+仓库,分类仓库不存在,品牌存在-返回成功");
		try {
			 bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
				//修改时间
				updateTimeConfig();
				//第二次执行
			   // bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
			
				String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
				check_verify(1,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_022() {
		Logger.start(true,"设置代理价按条件加价规则-品牌+分类+仓库,分类品牌不存在,仓库存在-返回成功");
		try {
			bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			//修改时间
			updateTimeConfig();
			//第二次执行
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		   // bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
		
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_023() {
		Logger.start(true,"设置代理价按条件加价规则-品牌+分类+仓库,品牌不存在,分类仓库存在-返回成功");
		try {
			 bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
				//修改时间
				updateTimeConfig();
				//第二次执行
			    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			   // bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    //bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
			
				String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
				check_verify(1,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_024() {
		Logger.start(true,"设置代理价按条件加价规则-品牌+分类+仓库,仓库不存在,分类品牌存在-返回成功");
		try {
	            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
				//修改时间
				updateTimeConfig();
				//第二次执行
			    //bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			   // bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			   bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
			
				String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
				check_verify(1,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_025() {
		Logger.start(true,"设置代理价按条件加价规则-品牌+分类+仓库,分类不存在,仓库品牌存在-返回成功");
		try {
			  bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
				//修改时间
				updateTimeConfig();
				//第二次执行
			  //  bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			   // bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
				call.setData(bean);
				call.callService();	
			
				String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
				check_verify(1,str);	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_026() {
		Logger.start(true,"设置代理价按条件加价规则-品牌+分类+仓库,分类仓库品牌都存在-返回失败");
		try {
            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			//修改时间
			updateTimeConfig();
			call.callService();	
			Logger.verifyEquals("500", call.getStatusCode1(), "验证status");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_030() {
		Logger.start(true,"设置代理价按条件加价规则-加价后小数点类型1精确到个位数");
		try {
            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setDecimalType(1);
		    //品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_031() {
		Logger.start(true,"设置代理价按条件加价规则-加价后小数点类型2保留小数点后1位");
		try {
            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setDecimalType(2);
		    //品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_032() {
		Logger.start(true,"设置代理价按条件加价规则-加价后小数点类型3保留小数点后2位");
		try {
            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setDecimalType(3);
		    //品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_033() {
		Logger.start(true,"设置代理价按条件加价规则-覆盖已添加的商品价格");
		try {
            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setRefreshProduct(true);
		    //品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_setAgentConditionMarkupConfig_034() {
		Logger.start(true,"设置代理价按条件加价规则-不覆盖已添加的商品价格");
		try {
            bean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setRefreshProduct(false);
		    //品牌
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			call.setData(bean);
			call.callService();	
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}